package com.hwang.demo1;

import java.util.Scanner;

/**
 * @ Author    :hwang
 * @ param     :BMI = WEIGHT / HIGH^2
 * @ return    :健康状况，偏瘦<=18.4；18.5<正常<=23.9，24.0<过重<=27.9，肥胖>28.0
 * @ Description:BMI健康管理
 * @ Date       :2019/11/9
*/

public class BMI {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入体重（KG）数据：");
        double weight = sc.nextDouble();
        System.out.println("请输入身高（M）数据：");
        double high = sc.nextDouble();

        double bmi = weight / (Math.pow(high,2));

        if (bmi<=18.4){
            String status = "偏瘦";
            System.out.println("BMI指数为："+bmi+"  身体状况："+status);
        }else if (bmi<=24 && bmi>18.4){
            String status = "正常";
            System.out.println("BMI指数为："+bmi+"  身体状况："+status);
        }else if (bmi<=28 && bmi>24){
            String status = "过重";
            System.out.println("BMI指数为："+bmi+"  身体状况："+status);
        }else{
            String status = "肥胖";
            System.out.println("BMI指数为："+bmi+"  身体状况："+status);
        }
    }
}
